package com;

import java.io.*;
import java.net.URL;
import java.util.List;

/**
 * @author ：Dsi
 * @date ：2021/11/18 15:29
 * Describe ：
 */
public class Picter {
    public static void main(String[] args) throws Throwable {
        picterDownloads();
    }

    private static void picterDownloads() throws Throwable {
        List<String> s1=new SetCollection().setCollection();
        int a1;
        for (String a:s1
             ) {
            URL u = new URL(a);
            InputStream i = u.openStream();
            new File("D:\\SecondElement\\" + s1.indexOf(a) + ".jpg").createNewFile();
            BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream("D:\\SecondElement\\" + s1.indexOf(a) + ".jpg"));
            for (int j = 0; (a1=i.read())!=-1; j++) {
                outputStream.write(a1);
            }
        }
    }
}
